using UnityEditor;
using UnityEngine;
using UnityEngine.UIElements;

namespace Framework.Fsm
{
    [CustomEditor(typeof(FsmData), true)]
    public class FsmInspector : Editor
    {
        protected VisualElement root;
        public override void OnInspectorGUI()
        {
            if (GUILayout.Button("打开编辑器", GUILayout.Height(40)))
            {
                EditorWindow.GetWindow<FsmGraphEditor>().Close();
                EditorWindow.GetWindow<FsmGraphEditor>().Initialize(target as FsmData);
            }
            // base.OnInspectorGUI();
        }
        // public override VisualElement CreateInspectorGUI()
        // {
        //     root = new VisualElement();
        //     root.Add(new Button(() => EditorWindow.GetWindow<FsmGraphEditor>().Initialize(target as FsmData))
        //     {
        //         text = "打开编辑器"
        //     });
        //     return root;
        // }
    }
}